package org.apache.dubbo.rpc.cluster;

import org.apache.dubbo.rpc.model.ScopeModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil;

public class RouterFactory$Adaptive implements RouterFactory {
    public Router getRouter(org.apache.dubbo.common.URL url) {
        String extName = url.getProtocol();

        ScopeModel scopeModel = ScopeModelUtil.getOrDefault(url.getScopeModel(),
                RouterFactory.class);

        RouterFactory extension =
                (RouterFactory)
                        scopeModel.getExtensionLoader(RouterFactory.class)
                                .getExtension(extName);

        return extension.getRouter(url);
    }
}
